<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>05.form_fields | KnockOut</title>
  <script src="../assets/knockout-3.5.1.js"></script>
</head>
<body>

  <button data-bind="click: myFunction">
    Click me
  </button>

  <script type="text/javascript">
    var vm = {
      // 第二个参数传入 DOM event
      myFunction: function(data, event) {
        if (event.shiftKey) {
          //do something different when user has shift key down
          alert('ShiftKey');
        } else {
          //do normal action
          alert('click');
        }
      }
    };

    ko.applyBindings(vm);
  </script>
      
</body>
</html>
